<div [@routerTransition]>
    <div class="m-subheader ">
        <div class="d-flex align-items-center">
            <div class="mr-auto col-xs-6">
                <h3 class="m-subheader__title m-subheader__title--separator">
                    <span>主材记录</span>
                </h3>
                <span class="m-section__sub">
                    主材记录的文本头信息
                </span>
            </div>
            <div class="col-xs-6 text-right">
                <!-- <button (click)="createOrEditEquipmentModal.show()" *ngIf="isGranted('Pages.Resource.Equipment.Operation')" class="btn btn-primary blue"><i
              class="fa fa-plus"></i> 创建新的设备</button> -->
            </div>
        </div>
    </div>

    <div class="m-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">
                <ul class="nav nav-tabs  m-tabs-line" role="tablist">
                    <li class="nav-item m-tabs__item">
                        <a
                            class="nav-link m-tabs__link"
                            data-toggle="tab"
                            href="javascript:;"
                            role="tab"
                            [ngClass]="{ active: tab === 1 }"
                            (click)="tabChange(1)"
                            >入库记录</a
                        >
                    </li>
                    <li class="nav-item m-tabs__item">
                        <a
                            class="nav-link m-tabs__link"
                            data-toggle="tab"
                            href="javascript:;"
                            role="tab"
                            [ngClass]="{ active: tab === 2 }"
                            (click)="tabChange(2)"
                            >出库记录</a
                        >
                    </li>
                    <li class="nav-item m-tabs__item">
                        <a
                            class="nav-link m-tabs__link"
                            data-toggle="tab"
                            href="javascript:;"
                            role="tab"
                            [ngClass]="{ active: tab === 3 }"
                            (click)="tabChange(5)"
                            >退库记录</a
                        >
                    </li>
                    <!-- <li class="nav-item m-tabs__item">
                        <a class="nav-link m-tabs__link" data-toggle="tab" href="javascript:;" role="tab"
                            [ngClass]="{'active': tab === 4}" (click)="tabChange(4)">退还物流记录</a>
                    </li> -->
                </ul>
                <div class="tab-content">
                    <form class="horizontal-form" autocomplete="off">
                        <div class="m-form m-form--label-align-right">
                            <div
                                class="row align-items-center m--margin-bottom-10"
                            >
                                <div class="col-xl-12">
                                    <div
                                        class="form-group m-form__group align-items-center"
                                    >
                                        <div class="input-group">
                                            <input
                                                [(ngModel)]="filterText"
                                                name="filterText"
                                                autoFocus
                                                class="form-control m-input"
                                                [placeholder]="
                                                    l('SearchWithThreeDot')
                                                "
                                                type="text"
                                            />
                                            <span class="input-group-btn">
                                                <button
                                                    (click)="getLogs()"
                                                    class="btn btn-primary"
                                                    type="submit"
                                                >
                                                    <i
                                                        class="flaticon-search-1"
                                                        [attr.aria-label]="
                                                            l('Search')
                                                        "
                                                    ></i>
                                                </button>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div
                                class="row m--margin-bottom-10"
                                [hidden]="!advancedFiltersAreShown"
                            >
                                <div class="col-md-6">
                                    <div class="m-checkbox-list"></div>
                                </div>
                            </div>

                            <div
                                class="row margin-bottom-10"
                                *ngIf="advancedFiltersAreShown"
                            >
                                <div class="col-sm-12 text-right">
                                    <button
                                        class="btn btn-metal"
                                        (click)="getLogs()"
                                    >
                                        <i class="fa fa-refresh"></i>
                                        {{ l('Refresh') }}
                                    </button>
                                </div>
                            </div>
                            <div class="row margin-bottom-10">
                                <div class="col-sm-12">
                                    <span
                                        class="clickable-item text-muted"
                                        *ngIf="!advancedFiltersAreShown"
                                        (click)="
                                            advancedFiltersAreShown = !advancedFiltersAreShown
                                        "
                                        ><i class="fa fa-angle-down"></i>
                                        {{ l('ShowAdvancedFilters') }}</span
                                    >
                                    <span
                                        class="clickable-item text-muted"
                                        *ngIf="advancedFiltersAreShown"
                                        (click)="
                                            advancedFiltersAreShown = !advancedFiltersAreShown
                                        "
                                        ><i class="fa fa-angle-up"></i>
                                        {{ l('HideAdvancedFilters') }}</span
                                    >
                                </div>
                            </div>
                        </div>
                    </form>

                    <div class="row align-items-center">
                        <!--<Primeng-TurboTable-Start>-->
                        <div
                            class="primeng-datatable-container"
                            [busyIf]="primengTableHelper.isLoading"
                        >
                            <p-table
                                #dataTable
                                (onLazyLoad)="getLogs($event)"
                                [value]="primengTableHelper.records"
                                rows="{{
                                    primengTableHelper.defaultRecordsCountPerPage
                                }}"
                                [paginator]="false"
                                [lazy]="true"
                                [scrollable]="true"
                                ScrollWidth="100%"
                                [responsive]="primengTableHelper.isResponsive"
                                [resizableColumns]="
                                    primengTableHelper.resizableColumns
                                "
                            >
                                <ng-template pTemplate="header">
                                    <tr>
                                        <th
                                            style="width: 160px"
                                            pSortableColumn="taskCode"
                                        >
                                            任务编号
                                            <p-sortIcon
                                                field="taskCode"
                                            ></p-sortIcon>
                                        </th>
                                        <th
                                            style="width: 160px"
                                            pSortableColumn="drawingCode"
                                        >
                                            图号
                                            <p-sortIcon
                                                field="drawingCode"
                                            ></p-sortIcon>
                                        </th>
                                        <th
                                            style="width: 160px"
                                            pSortableColumn="materialName"
                                        >
                                            材料名称
                                            <p-sortIcon
                                                field="materialName"
                                            ></p-sortIcon>
                                        </th>
                                        <th
                                            style="width: 100px"
                                            pSortableColumn="paiHao"
                                        >
                                            牌号
                                            <p-sortIcon
                                                field="paiHao"
                                            ></p-sortIcon>
                                        </th>
                                        <th
                                            style="width: 100px"
                                            pSortableColumn="materialSpec"
                                        >
                                            规格
                                            <p-sortIcon
                                                field="materialSpec"
                                            ></p-sortIcon>
                                        </th>
                                        <th style="width: 100px">
                                            数量
                                        </th>
                                        <!-- <th style="width: 150px">
                                            位置
                                        </th> -->
                                        <th style="width: 100px">
                                            合格证
                                        </th>
                                        <th style="width: 120px">
                                            时间
                                        </th>
                                        <!-- <th style="width: 100px">
                                            人员
                                        </th> -->
                                    </tr>
                                </ng-template>
                                <ng-template
                                    pTemplate="body"
                                    let-record="$implicit"
                                >
                                    <tr>
                                        <td style="width: 160px">
                                            {{ record.requestedTaskNum }}
                                        </td>
                                        <td style="width: 160px">
                                            {{ record.requestedDrawingNum }}
                                        </td>
                                        <td style="width: 160px">
                                            {{ record.displayName }}
                                        </td>
                                        <td style="width: 100px">
                                            {{ record.materialModel }}
                                        </td>
                                        <td style="width: 100px">
                                            {{ record.specification }}
                                        </td>
                                        <td style="width: 100px">
                                            {{ record.itemAmount }}
                                        </td>
                                        <!-- <td style="width: 150px">
                                            {{ record.locationOfMaterial.displayName }}
                                        </td> -->
                                        <td style="width: 100px">
                                            {{ record.certificateNo }}
                                        </td>
                                        <td style="width: 120px">
                                            {{
                                                record.lastModificationTime
                                                    | momentFormat: 'YYYY-MM-DD'
                                            }}
                                        </td>
                                        <!-- <td style="width: 120px">
                                            {{ record.materialForProduct.creatorUserName }}
                                        </td> -->
                                    </tr>
                                </ng-template>
                            </p-table>
                            <div
                                class="primeng-no-data"
                                *ngIf="
                                    primengTableHelper.totalRecordsCount == 0
                                "
                            >
                                {{ l('NoData') }}
                            </div>
                            <div class="primeng-paging-container">
                                <p-paginator
                                    rows="{{
                                        primengTableHelper.defaultRecordsCountPerPage
                                    }}"
                                    #paginator
                                    (onPageChange)="getLogs($event)"
                                    [totalRecords]="
                                        primengTableHelper.totalRecordsCount
                                    "
                                    [rowsPerPageOptions]="
                                        primengTableHelper.predefinedRecordsCountPerPage
                                    "
                                >
                                </p-paginator>
                                <span class="total-records-count">
                                    共计：{{
                                        primengTableHelper.totalRecordsCount
                                    }}
                                </span>
                            </div>
                        </div>
                        <!--<Primeng-TurboTable-End>-->
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
